package megrez.oss.minio.utils;

import org.springframework.util.Assert;

import lombok.experimental.UtilityClass;
import megrez.oss.common.FileNameHelper;
import megrez.oss.common.Pair;

/**
 * 工具
 * 
 * @author Lucky Yang
 * @since 2.6.9
 */
@UtilityClass
public class Helper {
    public static final String PATH_SEP = "/";

    /**
     * 生成object name，包含两级目录结构
     * 
     * @param objectId
     * @return
     */
    public String objectName(final String objectId) {
        Assert.hasText(objectId, "'objectId' must have value");

        Pair<String, String> path = FileNameHelper.generalHashPath(objectId);
        return path.value0 + PATH_SEP + path.value1 + PATH_SEP + objectId;
    }
}
